#include <iostream>
#include <cstdio>

using namespace std; 

typedef long long ll; 

//res<m: return >0
//res==m: return 0
//else: return <0
ll calc_m(ll m, ll a, ll b)
{
	return m-(b-a+1)*(b+a)/2; 
}

int main()
{
	ll m, a, b, k, r, x, y; 
	cin>>m; 
	
	for (ll i=1; i<m; i++) {
		a = i; 
		b = m - i;
		if (a>=b) {
			break; 
		}
		x = a; 
		y = b; 
		k = b; 
		do {
			r = calc_m(m, a, k); 
			if (r==0) {
				cout<<a<<" "<<k<<endl; 
				break; 
			} 
			if (r>0) {
				x = k; 
			} else {
				y = k; 
			}
			k = (x+y)/2; 
		} while(x<y-1); 
	}
	return 0; 
}


